﻿using System.Collections.Generic;
using System.Linq;

namespace Pap.Data
{
    /// <summary>
    /// 
    /// </summary>
    public partial class LoanExecution : ILoanExecution
    {
        /// <summary>
        /// Gets the customer loan.
        /// </summary>
        ICustomerLoan ILoanExecution.CustomerLoan
        {
            get { return this.CustomerLoan; }
        }

        /// <summary>
        /// Gets the loan execution installments LST.
        /// </summary>
        public IEnumerable<ILoanExecutionInstallment> LoanExecutionInstallmentsLst
        {
            get
            {
                return this.LoanExecutionInstallments.OfType<ILoanExecutionInstallment>();
            }
        }

        /// <summary>
        /// Gets the loan execution attachments LST.
        /// </summary>
        public IEnumerable<ILoanExecutionAttachment> LoanExecutionAttachmentsLst
        {
            get
            {
                return this.LoanExecutionAttachments.OfType<ILoanExecutionAttachment>();
            }
        }

        /// <summary>
        /// Gets the payment method obj.
        /// </summary>
        public ILoanPaymentMethod PaymentMethodObj
        {
            get { return this.CustomerLoan.LoanPaymentMethod; }
        }

        /// <summary>
        /// Adds the installment.
        /// </summary>
        /// <param name="installment">The installment.</param>
        public void AddInstallment(ILoanExecutionInstallment installment)
        {
            this.LoanExecutionInstallments.Add(installment as LoanExecutionInstallment);
        }
    }
}
